<extend name="Public/base"/>
<block name="body">
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
        window.UEDITOR_HOME_URL='__PUBLIC__/ueditor/';
        window.onload=function(){
            window.UEDITOR_CONFIG.imageUrl = '{:U('Editor')}';
            window.UEDITOR_CONFIG.imagePath = '__ROOT__/Uploads/Editor/';    
        }
        
         /**function gradeChange(){
         var objS = document.getElementById("selectId");
         var typeid = objS.options[objS.selectedIndex].typeid;
         alert(typeid);
        }**/

        $(function(){
            var selectId=$("select[name=pid] option[selected]").attr('typeid');
            $('#type').val(selectId);

            $("#selectId").change(function(){
                var type=$(this).find('option:selected').attr('typeid');
                $('#type').val(type); 
            });
        });
</script>
<div class="widget-box">
          <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span>
            <h5>{$meta_title}</h5>
             <div class="buttons">
                 <a class="btn btn-mini"  href="javascript:history.go(-1);">返回</a>
             </div>
           </div>
          <div class="widget-content ">
                    <form class="form-horizontal" action="{:U('Add')}" method="post" enctype="multipart/form-data" >
                                    <div class="control-group">
                                        <label class="control-label">分类</label>
                                        <div class="controls">
                                              <select name="pid" id="selectId" >
                                                   <option value="" <if condition="$_GET['pid'] eq ''">selected</if> >--请选择--</option>                                   
                                                   <volist name="Think.config.PRO_LIST_TYPE" id="newsType" key="k">
                                                      <option value="{$k}" disabled>{$newsType}</option>
                                                      <volist name="list" id="l">
                                                         <if condition="$l['type'] eq $k">
                                                         <option value="{$l.id}" typeid="{$k}" <if condition="$l['id'] eq $_GET['pid']">selected</if>>&nbsp;&nbsp;&nbsp;|-{$l.title}</option>
                                                         </if>
                                                      </volist>
                                                   </volist>
                                              </select><input type="hidden" name="type" id="type">      
                                        </div>
                                    </div>
                               <div class="control-group">
                                        <label class="control-label">编号</label>
                                        <div class="controls">
                                            <input type="text" name="number" style="width:480px;">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">名称</label>
                                        <div class="controls">
                                            <input type="text" name="title" style="width:480px;">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">规格</label>
                                        <div class="controls">
                                            <input type="text" name="spec" style="width:480px;">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">图片</label>
                                        <div class="controls">
                                            <input type="file" name="pic" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">内容</label>
                                        <div class="controls">
                                            <script type="text/javascript">
                                                  UE.getEditor('conter');
                                            </script>
                                            <textarea name="conter" id="conter" style="height:400px; width:80%;"></textarea>
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">是否开启</label>
                                        <div class="controls">
                                            <label><input type="radio" name="status" value="1" checked="checked"> 开启</label>
                                            <label><input type="radio" name="status" value="0"> 关闭</label>
                                        </div>
                                    </div>
                               <div class="form-actions">
                               
                               <input type="hidden" name="p" value="2">
                               <input type="hidden" name="lang" value="{$langSet}">
                               <input type="hidden" name="userId" value="{$userId}">
                               <button class="btn btn-primary" type="submit">保存</button>
                           </div>
                     </form>
          </div>
        </div>
</block>
